package com.tengju.data.infrastructure.repository;

import com.tengju.data.domain.model.activity.ActivityId;
import com.tengju.data.domain.model.activity.ActivitySaleMoneyRepository;
import com.tengju.data.domain.model.activity.SaleSituation;
import com.tengju.data.domain.model.user.UserIdCode;
import com.tengju.data.infrastructure.persistence.mybatis.dataobject.ReportActivitySaleMoneyDO;
import com.tengju.data.infrastructure.persistence.mybatis.mapper.data.custom.ReportActivitySaleMoneyDOMapper;
import com.tengju.data.infrastructure.repository.convert.BigDataActivitySaleMoneyConvert;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

@Repository
public class ActivitySaleMoneyRepositoryImpl implements ActivitySaleMoneyRepository {

    @Resource
    ReportActivitySaleMoneyDOMapper reportActivitySaleMoneyDOMapper;

    @Override
    public SaleSituation query(ActivityId activityId, UserIdCode idCode, Integer version) {
        ReportActivitySaleMoneyDO bigDataActivitySaleMoneyDO =
                reportActivitySaleMoneyDOMapper.query(activityId.getValue(), idCode.getValue(), version);
        return BigDataActivitySaleMoneyConvert.convertToModel(bigDataActivitySaleMoneyDO);
    }
}
